<template>
  <div id="index">
    <dv-full-screen-container class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <!-- <div v-else class="host-body">
        <div class="body-box"> -->
      <iframe class="mainFrame" :src="a" frameborder="0"></iframe>
      <!-- </div>
      </div> -->
    </dv-full-screen-container>
  </div>
</template>

<script>
// import { formatTime } from '../utils/index.js'
export default {
  data () {
    return {
      datePara: '',
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
      a: ''
    };
  },
  mounted () {
    this.initFrame()
    // this.timeFn();
    this.cancelLoading();
  },
  watch: {
    $route (to, from) {
      console.log(to)
      console.log(from)
      this.initFrame()
      // if(from.name == null){
      //      sessionStorage.removeItem('beforeunload');
      // }
    }
  },
  methods: {
    initFrame () {
      // this.datePara = this.$route.query.date
      // if (!this.datePara){
      //   this.datePara = this.$route.params.date
      // }
      // if (!this.datePara){
      //   this.datePara = formatTime(new Date(), 'yyyy-MM')
      // }
      this.a = 'http://111.160.78.62:9936/' + this.$route.query.linkIndex + '.html?user=' + this.$route.query.userName + '&date=' + this.$route.query.date + '&ClientNo=' + this.$route.query.ClientNo
      // document.getElementById('mainFrame').src = url
      // }, 100)
    },
    // timeFn () {
    //   setInterval(() => {
    //     this.dateDay = formatTime(new Date(), 'HH: mm: ss');
    //     this.dateYear = formatTime(new Date(), 'yyyy-MM-dd');
    //     this.dateWeek = this.weekday[new Date().getDay()];
    //   }, 1000)
    // },
    cancelLoading () {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    }
  }
};
</script>

<style lang="scss">
@import '../assets/scss/index.scss';
.mainFrame {
  height: 100%;
  // height: calc(100% - 232px);
  width: 100%;
}
</style>